package cn.wolfcode.shop.cloud.mq;

import cn.wolfcode.shop.cloud.web.controller.SeckillOrderInfoController;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
@RocketMQMessageListener(
        consumerGroup = MQConstans.CREATE_ORDER_FLAG_GROUP,
        topic = MQConstans.CREATE_ORDER,
        selectorExpression = MQConstans.CREATE_ORDER_FLAG_TAG,
        //消息类型：消费为广播模式
        messageModel = MessageModel.BROADCASTING
)
@Component
public class OrderFlagMQListener implements RocketMQListener<Long> {

    @Override
    public void onMessage(Long seckillId ) {
        System.out.println("进入广播队列中，修改本地标识");
        //修改本地标识
        SeckillOrderInfoController.map.put(seckillId,false);

    }
}
